package com.eonmind.vip.controller;


import com.eonmind.common.contract.data.response.ResponseEntity;
import com.eonmind.common.provider.entity.vip.VipPackage;
import com.eonmind.common.security.annotations.UserInfo;
import com.eonmind.user.contract.dto.UserInfoData;
import com.eonmind.vip.dto.UserWelfareDto;
import com.eonmind.vip.service.VipPackageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 套餐相关接口
 */
@RestController
@RequestMapping("/vipPackage")
public class VipPackageController {

    @Autowired
    private VipPackageService vipPackageService;

    /**
     * 获取所有套餐信息
     * @return ResponseEntity<List<VipPackage>>
     * @ignoreParams
     */
    @GetMapping("/getAllPackages")
    public ResponseEntity<List<VipPackage>> getAllPackage() {
        return ResponseEntity.success(vipPackageService.getAllPackages());
    }

    /**
     * 获取所有套餐信息
     * @return ResponseEntity<List<VipPackage>>
     * @ignoreParams
     */
    @GetMapping("/getAllActPackages")
    @UserInfo
    public ResponseEntity<List<UserWelfareDto.UserActivePackage>> getAllActivePackage(UserInfoData userInfoData) {
        return ResponseEntity.success(vipPackageService.getAllActivePackages(userInfoData));
    }
}
